//
//  StatisticsDetailController.m
//  ios-supplier
//
//  Created by feynmanyuan on 15/4/21.
//  Copyright (c) 2015年 feynmanyuan. All rights reserved.
//

#import "StatisticsDetailController.h"
#import "JFBSettlementDetailDS.h"

@interface StatisticsDetailController ()
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *policyLabel;
@property (weak, nonatomic) IBOutlet UILabel *cashCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *cashPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *onlineCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *onlinePriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *refundCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *refundPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *promotionPolicyLabel;
@property (weak, nonatomic) IBOutlet UILabel *promotionPolicyCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *promotionPolicyPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *refundPolicyLabel;
@property (weak, nonatomic) IBOutlet UINavigationItem *nav;

@end

@implementation StatisticsDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self reload:nil];
}

-(void)reload:(__unused id)sender{
    [JFBSettlementDetailDS loadSettlementDetail:^(JFBSettlementDetailDS *detail, NSError *error) {
        self.priceLabel.text = [NSString stringWithFormat:@"＋¥ %@", [NSString decimalToString:detail.price]];
        [self.nav setTitle:detail.date];
        self.policyLabel.text = detail.policy;
        self.cashCountLabel.text = [NSString stringWithFormat:@"%lu单", (unsigned long)detail.cashCount];
        self.cashPriceLabel.text = [NSString stringWithFormat:@"¥ %@", [NSString decimalToString:detail.cashPrice]];
        self.onlineCountLabel.text = [NSString stringWithFormat:@"%lu单", (unsigned long)detail.onlineCount];
        self.refundPolicyLabel.text = [NSString stringWithFormat:@"配送费统计  (%@)", detail.refundPolicy];
        self.onlinePriceLabel.text = [NSString stringWithFormat:@"¥ %@", [NSString decimalToString:detail.onlinePrice]];
        self.refundCountLabel.text = [NSString stringWithFormat:@"%lu单", (unsigned long)detail.refundCount];
        self.refundPriceLabel.text = [NSString stringWithFormat:@"¥ %@", [NSString decimalToString:detail.refundPrice]];
        self.promotionPolicyLabel.text = detail.promotionPolicy;
        self.promotionPolicyCountLabel.text = [NSString stringWithFormat:@"%lu单", (unsigned long)detail.promotionCount];
        self.promotionPolicyPriceLabel.text = [NSString stringWithFormat:@"¥ %@", [NSString decimalToString:detail.promotionPrice]];
        
    } settleID:self.ID];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
